﻿
<?php use_stylesheet('result.css') ?>
<h1>Результат</h1>
    <?php
    	$count=0;
		$c = new Criteria();	
		$c->addSelectColumn(QuestionPeer::BODY);
		$c->addSelectColumn(AnswerPeer::BODY);
		$c->addSelectColumn(ResultPeer::POINT);
		$c->addSelectColumn(ResultPeer::CHECK);
		$c->addSelectColumn(ResultPeer::ID);
		$c->add(ResultPeer::USER_ID, $userss);	
		$c->addJoin(ResultPeer::QUESTION_ID,QuestionPeer::ID);
		$c->addJoin(ResultPeer::ANSWER_ID,ANSWERPeer::ID);	    
		$results = ResultPeer::doSelectStmt($c);
		
		while($row = $results ->fetch(PDO::FETCH_BOTH)) 
		{
		 if($row[3]==1){$result='result_true';}else($result='result_false') 
	?>
		<div class="<?php echo $result ?>">
				<div class="question"><?php echo $row[0] ?></div>
				<div class="answer"><?php echo $row[1] ?></div>
				<div class="point"><?php echo $row[2]; $count=$count+$row[2]; ?></div>
				<div class="img"></div>						  			
   		</div>
   		
   <?php
		}
    ?>
       <div class="result">Сумма баллов: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $count; ?></div>
   


